package models

import cm "github.com/PhlexTheCharr/gofurry-cloud-service/common/models"

const TableNameOlSaying = "ol_saying"

// OlSaying mapped from table <ol_saying>
type OlSaying struct {
	ID         int64        `gorm:"column:id;type:bigint;primaryKey;comment:金句表ID" json:"id"`                                    // 金句表ID
	Author     *string      `gorm:"column:author;type:character varying(255);comment:金句提供者" json:"author"`                       // 金句提供者
	Saying     string       `gorm:"column:saying;type:character varying(255);not null;comment:金句" json:"saying"`                 // 金句
	CreateTime cm.LocalTime `gorm:"column:create_time;type:timestamp(0);not null;autoCreateTime;comment:创建时间" json:"createTime"` // 创建时间
	UpdateTime cm.LocalTime `gorm:"column:update_time;type:timestamp(0);not null;autoUpdateTime;comment:修改时间" json:"updateTime"` // 修改时间
}

// TableName OlSaying's table name
func (*OlSaying) TableName() string {
	return TableNameOlSaying
}

type AddSayingRequest struct {
	Author *string `form:"author" json:"author" validate:"omitempty"`
	Saying string  `form:"saying" json:"saying" validate:"required"`
}

type SayingPageQuery struct {
	cm.PageReq
	Author *string `form:"author" json:"author" validate:"omitempty"`
	Saying *string `form:"saying" json:"saying" validate:"omitempty"`
}

type SayingPageVo struct {
	ID     int64   `form:"id" json:"id,string"`
	Author *string `form:"author" json:"author"`
	Saying string  `form:"saying" json:"saying"`
}

type UpdateSayingRequest struct {
	ID     int64   `form:"id" json:"id" validate:"required"`
	Author *string `form:"author" json:"author" validate:"omitempty"`
	Saying string  `form:"saying" json:"saying" validate:"required"`
}

type SayingDeleteRequest struct {
	cm.Delete
}
